class Animal:
    def __init__(self, name):
        self.name = name
    def speak(self):
        return "动物发出声音"
class Dog(Animal):
    def speak(self): # 重写方法
        return f"{self.name} 汪汪叫"
# 多继承示例：Duck 继承自 Flyer 和 Swimmer
class Flyer:
    def fly(self):
        return "我会飞"
class Swimmer:
    def swim(self):
        return "我会游泳"
class Duck(Flyer, Swimmer):
    def __init__(self, name):
        self.name = name

# 测试代码
dog = Dog("旺财")
print(dog.speak()) # 输出：旺财 汪汪叫
duck = Duck("小黄")
print(duck.fly()) # 输出：我会飞
print(duck.swim()) # 输出：我会游泳